#include "fxcc/imgui/Editor.h"
#include "fxcc/core/graph/common/RenderTargetJack.h"

using namespace fxcc::graph::common;
using namespace fxcc::imgui;

template <>
bool Editor::Edit<RenderTargetJack::Desc>(const std::string& label, RenderTargetJack::Desc& inst)
{
    EditInst<ImageMipmap::MipMapData>("m_MipmapData", inst.m_MipmapData);
    EditInst<int>("m_NumTextures", inst.m_NumTextures);
    EditInst<fxcc::graph::common::AttachmentType>("m_AttachmentType ", inst.m_AttachmentType);

    return false;
}


template <>
bool Editor::Edit<RenderTargetJack>(const std::string& label, RenderTargetJack& inst)
{
    EditInst<RenderTargetJack::Desc>("m_Desc", inst.m_Desc);

    ImVec2 ContentRegionAvailSize = ImGui::GetContentRegionAvail();

    for (int index = 0; index < inst.GetNumTextures(); index++)
    {
        ImVec2 imageSize;
        imageSize.x = ContentRegionAvailSize.x;
        imageSize.y = imageSize.x / inst.Aspect();

        auto texture = inst.GetTexture(index);

        ImGui::Image(texture->GetTextureId(), imageSize, ImVec2(0, 1), ImVec2(1, 0));
    }

    return false;
}
